import router from '@system.router';
export default {
    data: {
        categoryName: "",
        gender: "",
        shoesShowList: [],
        shoesList: [],
        shoes: [
            {tname: "高跟鞋", name: "欧洲站春秋新款小跟鞋女细跟百搭女鞋子中跟鞋尖头单鞋女鞋子潮", gender: "female",img: "s1",priceNow:"340",priceOld: "534"},
            {tname: "高跟鞋", name: "法式高跟鞋女细跟春秋新款宴会性感气质百搭尖头单鞋女鞋子潮",gender: "female", img: "s2",priceNow:"89",priceOld: "134"},
            {tname: "高跟鞋", name: "高跟鞋女细跟秋季新款时尚千鸟格宴会尖头女士鞋子女单鞋", gender: "female",img: "s3",priceNow:"99",priceOld: "184"},
            {tname: "高跟鞋", name: "欧洲站春秋新款小跟鞋女细跟百搭女鞋子中跟鞋尖头单鞋女鞋子潮",gender: "female", img: "s2",priceNow:"54",priceOld: "88"},
            {tname: "高跟鞋", name: "欧洲站春秋新款小跟鞋女细跟百搭女鞋子中跟鞋尖头单鞋女鞋子潮",gender: "female", img: "s1",priceNow:"150",priceOld: "284"},
            {tname: "高跟鞋", name: "欧洲站春秋新款小跟鞋女细跟百搭女鞋子中跟鞋尖头单鞋女鞋子潮",gender: "female", img: "s3",priceNow:"105",priceOld: "190"},
            {tname: "高跟鞋", name: "高跟鞋女细跟秋季新款时尚千鸟格宴会尖头女士鞋子女单鞋", gender: "female",img: "s2",priceNow:"210",priceOld: "320"},
            {tname: "高跟鞋", name: "高跟鞋女细跟秋季新款时尚千鸟格宴会尖头女士鞋子女单鞋", gender: "female",img: "s1",priceNow:"124",priceOld: "136"},
            {tname: "高跟鞋", name: "高跟鞋女细跟秋季新款时尚千鸟格宴会尖头女士鞋子女单鞋", gender: "female",img: "s3",priceNow:"67",priceOld: "194"},

            {tname: "洞洞鞋", name: "老刘同款2022新款防滑软底凉拖鞋女款舒适厚底凉鞋沙滩鞋百搭女鞋", gender: "female",img: "shoes11",priceNow:"34",priceOld: "48.8"},
            {tname: "洞洞鞋", name: "2022新款防滑软底凉拖鞋女款舒适厚底凉鞋沙滩鞋百搭女鞋", gender: "female",img: "shoes12",priceNow:"29.8",priceOld: "35"},
            {tname: "洞洞鞋", name: "【刘总同款】2022新款防滑软底凉拖鞋女款舒适厚底凉鞋沙滩鞋百搭女鞋", gender: "female",img: "shoes13",priceNow:"167",priceOld: "194"},
            {tname: "洞洞鞋", name: "【新品】洞洞鞋少女心蝴蝶结ins风 2022款", gender: "female",img: "shoes1",priceNow:"99",priceOld: "154"}
        ],
        filter: [
            {id: "1", value: '￥100以下', choiced: 'false'},
            {id: "2", value: '￥100-￥150', choiced: 'false'},
            {id: "3", value: '￥150以上', choiced: 'false'}
        ],
    },
    changeFilter(index) {
        this.shoesShowList = [];
        if(this.filter[index].choiced == "true"){
           this.filter[index].choiced = "false";
           for(let i = 0; i < this.shoesList.length; i++) {
               this.shoesShowList.push(this.shoesList[i]);
           }

        } else {
            for(let i = 0; i<this.filter.length; i++) {
                this.filter[i].choiced = "false";
            }
            this.filter[index].choiced = "true";
            if(this.filter[index].value == "￥100以下") {
                for(let i = 0; i < this.shoesList.length; i++) {
                    if (parseInt(this.shoesList[i].priceNow) < 100) {
                        this.shoesShowList.push(this.shoesList[i]);
                    }
                }

            }else if (this.filter[index].value == "￥100-￥150") {
                for(let i = 0; i < this.shoesList.length; i++) {
                    if (parseInt(this.shoesList[i].priceNow) >= 100 && parseInt(this.shoesList[i].priceNow) <= 150) {
                        this.shoesShowList.push(this.shoesList[i]);
                    }
                }
            } else {
                for(let i = 0; i < this.shoesList.length; i++) {
                    if (parseInt(this.shoesList[i].priceNow) > 150) {
                        this.shoesShowList.push(this.shoesList[i]);
                    }
                }
            }
        }

    },
    onInit() {
        for(let i = 0; i < this.shoes.length; i++) {
            if(this.shoes[i].tname == this.categoryName && this.shoes[i].gender == this.gender) {
                this.shoesShowList.push(this.shoes[i]);
            }
        }
        this.shoesList = this.shoesShowList;
    },
    goDetail(title,img,price) {
        router.push({
            uri: 'pages/detail/detail'

        })
    }


}
